import storageApi from '../../core/storage/storage';

@Inject('$log', '$rootScope', '$state', 'securityTableService')
class SecurityTableController {
  constructor() {
    this.name = $state.params.name;
    this.boxId = $state.params.boxId;
    this.$init();
  }

  $init() {
    this.mapParams = {
      orgType: this.$rootScope.orgType || storageApi.get('orgType'),
      templateType: this.boxId,
    };

    this.$queryTable();
  }

  $queryTable() {
    this.securityTableService.query({ mapParams: this.mapParams })
      .then((res) => {
        if (res.success) {
          this.securityTable = res.rows;
        }
      });
  }

  /*eslint-disable */
  getType(type) {
    switch (type) {
      case '1':
        return '常用';
        break;
      case '2':
        return '';
        break;
      default:
        break;
    }
  }

}

export default SecurityTableController;

